import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; //ios风格

///进度条
class ProgressWidgetDemo extends StatelessWidget {
  final String title;

  const ProgressWidgetDemo({Key? key, required this.title}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("$title"),
        centerTitle: true,
        elevation: 10.0,
      ),
      body: ProgressDemo(),
    );
  }
}

class ProgressDemo extends StatelessWidget {
  const ProgressDemo({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.all(10),
      child: Column(
        children: [
          LinearProgressIndicator(), //直线进度条
          SizedBox(
            height: 20,
          ),
          LinearProgressIndicator(
            value: .5,
            //设置进度条颜色
            valueColor: AlwaysStoppedAnimation(Colors.red),
            backgroundColor: Colors.grey[200],
          ),
          SizedBox(
            height: 20,
          ),
          CircularProgressIndicator(
            backgroundColor: Colors.grey[200],
          ),
          SizedBox(height: 20),
          CircularProgressIndicator(
            value: 0.5,
            valueColor: AlwaysStoppedAnimation(Colors.blue),
            backgroundColor: Colors.grey[200],
          ),
          SizedBox(
            height: 20,
          ),
          Container(
            //自定义大小
            height: 100,
            width: 100,
            child: CircularProgressIndicator(
              valueColor: AlwaysStoppedAnimation(Colors.blue),
              backgroundColor: Colors.grey[200],
            ),
          ),
          SizedBox(
            height: 20,
          ),
          //ios风格
          CupertinoActivityIndicator()
        ],
      ),
    );
  }
}
